# 导入requests请求库
import requests
import httpx

# 创建函数
def img():
   # 同一资源定位符
   url="http://www.techlabplt.com/upload/focus1.jpg"
   # 请求头,字典格式
   headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"}
   # 功能  参数  返回值
   res = requests.get(url,headers=headers).content

   with open("./图片.jpg", "wb") as f:
      f.write(res)
# 调用函数
img()
